﻿using System.Collections.Generic;


namespace ProblemsSet
{
    public class Problem_1: BaseProblem
    {
        public override object GetResult()
        {
            var res = new List<long>();
            FormeMiltiplies(1000, new []{3, 5}, res);
            return MathLogic.GetSumOfInt(res);
        }

        private static void FormeMiltiplies(int maxInt, IEnumerable<int> bases, ICollection<long> result)
        {
            foreach (var i in bases)
            {
                for (var j=1; j <= (maxInt-1)/i; j++)
                {
                    if (!result.Contains(j*i)) result.Add(j*i);
                }
            }
        }


        public override string Problem
        {
            get
            {
                return @"If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.

Find the sum of all the multiples of 3 or 5 below 1000.";
            }
        }

        public override bool IsSolved
        {
            get
            {
                return true;
            }
        }

        public override object Answer
        {
            get
            {
                return 233168;
            }
        }
    }
}
